package com.haojiu.service;

import com.github.pagehelper.PageHelper;
import com.haojiu.mapper.UserMapper;
import com.haojiu.pojo.User;

import java.util.List;

/**
 * @author:我叫浩九
 * @date：2021/8/25 9:25
 * create in RuGao JiangSu
 */
public class UserServiceImpl implements UserService{
    private UserMapper userMapper;
    public void setUserMapper(UserMapper userMapper){
        this.userMapper=userMapper;
    }
    @Override
    public int addUser(User user) {
        return userMapper.addUser(user);
    }

    @Override
    public User queryUserByName(String username) {
        return userMapper.queryUserByName(username);
    }

    @Override
    public int deleteUserByName(String username) {
        return userMapper.deleteUserByName(username);
    }

    @Override
    public int updateUser(User user) {
        return userMapper.updateUser(user);
    }

    @Override
    public List<User> queryAllUser() {
     return userMapper.queryAllUser();
    }

    @Override
    public List<User> getAllManager(String userType) {
        return userMapper.getAllManager(userType);
    }

    @Override
    public List<User> getAllManager(String userType, int page, int size) {
        PageHelper.startPage(page,size);
        return userMapper.getAllManager(userType);
    }

    @Override
    public List<User> queryAllUser(int page,int size) {
        PageHelper.startPage(page,size);
        return userMapper.queryAllUser();
    }

}
